Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wire: check TXID length before creating outpoint #2233

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

jharveyb
Copy link
Contributor

chainhash.NewHashFromStr will zero-pad the given string if it's smaller than 32 bytes / 64 hex chars.

That's fine, but when creating an OutPoint from a string, the TXID part of the string must be exactly 64 hex chars to (possibly) be a valid TXID. Right now, NewOutPointFromString accepts a TXID of less than 64 chars, and will end up padding the end with 0's.

This PR rejects incorrectly-sized TXID strings in NewOutPointFromString.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 10394619593

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • 6 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.006%) to 57.232%

Files with Coverage Reduction New Missed Lines %
peer/peer.go 6 74.16%
Totals Coverage Status
Change from base Build 10312227216: -0.006%
Covered Lines: 29841
Relevant Lines: 52140

💛 - Coveralls

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 💿

@Roasbeef Roasbeef merged commit 029e5a3 into btcsuite:master Aug 15, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants